import { Modal } from "antd";

type Props = {
  show: boolean;
  title?: string;
  emitClose: Function;
  children: any;
};

export default function DialogModal(props: Props) {
  const { show, emitClose, children, title } = props;

  const handleCloseModal = () => {
    emitClose();
  };

  return (
    <div>
      <Modal
        // 预渲染
        forceRender
        title={title || "提示"}
        keyboard={false}
        maskClosable={false}
        open={show}
        onOk={handleCloseModal}
        onCancel={handleCloseModal}
        footer={null}
      >
        <div>{children}</div>
      </Modal>
    </div>
  );
}
